CXX = g++
CXXFLAGS = -W -Wall -ansi -pedantic -g
LDFLAGS = -lsfml-system -lsfml-window -lsfml-graphics
EXEC = ./main
OBJDIR = obj
BINDIR = ./
SRC = $(wildcard *.cpp)
OBJ = $(SRC:.cpp=.o)
OBJ := $(addprefix $(OBJDIR)/, $(OBJ))

all: $(EXEC)

$(EXEC): $(OBJ)
	@mkdir -p $(BINDIR)
	@$(CXX) -o $(BINDIR)/$@ $^ $(LDFLAGS)

$(OBJDIR)/%.o: %.cpp
	@$(CXX) -o $@ -c $< $(CXXFLAGS)

.PHONY: clean mrproper

clean:
	@rm -rf $(OBJDIR)/*.o

mrproper: clean
	@rm -f $(BINDIR)/$(EXEC)